﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Routing;

/// <summary>
/// Summary description for UrlRouting
/// </summary>
public class UrlRouting
{
    public static void MapRoutes(RouteCollection routes)
    {
        //routes.Add("dashboard_overview", new Route("dashboard/overview", new WebFormsRouteHandler<IHttpHandler>("~/pages/Candidates/Dashboard/Default.aspx")));
        //routes.Add("dashboard", new Route("dashboard", new WebFormsRouteHandler<IHttpHandler>("~/pages/Candidates/Dashboard/Default.aspx")));
        
       
		routes.Add("forgotPassword", new Route("password-recovery", new WebFormsRouteHandler<IHttpHandler>("~/pages/ForgotPassword.aspx")));
        routes.Add("profile", new Route("home", new WebFormsRouteHandler<IHttpHandler>("~/pages/Profile/ProfilePage.aspx")));
		routes.Add("profile-settings", new Route("settings", new WebFormsRouteHandler<IHttpHandler>("~/pages/Profile/Settings.aspx")));
		routes.Add("change-password", new Route("change-password", new WebFormsRouteHandler<IHttpHandler>("~/pages/Profile/ChangePassword.aspx")));
        routes.Add("signUp", new Route("sign-up", new WebFormsRouteHandler<IHttpHandler>("~/pages/Registration/SignUp.aspx")));
        routes.Add("signUp-moreAboutYou", new Route("sign-up/more-about-you", new WebFormsRouteHandler<IHttpHandler>("~/pages/Registration/MoreAboutYou.aspx")));       

		var errorDefaults = new RouteValueDictionary(); errorDefaults.Add("ErrorType", "comming-soon");
		routes.Add("errorPage", new Route("message/{ErrorType}", errorDefaults, new WebFormsRouteHandler<IErrorPageHandler>("~/pages/Error/Error.aspx")));       
		//routes.Add("commingSoon", new Route("message/{error}", new WebFormsRouteHandler<IHttpHandler>("~/pages/Error/Error.aspx")));

		//routes.Add("textPage", new Route("text/{PageName}", new WebFormsRouteHandler<ItextPageHandler>("~/Pages/Texts/Text.aspx")));
		//routes.Add("privacy", new Route("privacy", new TextPageRoutHandler("~/Pages/Texts/Text.aspx")));
		//routes.Add("terms", new Route("terms", new TextPageRoutHandler("~/Pages/Texts/Text.aspx")));
		//routes.Add("about", new Route("about", new TextPageRoutHandler("~/Pages/Texts/Text.aspx")));
		//routes.Add("help", new Route("help",  new TextPageRoutHandler("~/Pages/Texts/Text.aspx")));
		//routes.Add("contactUs", new Route("contact",  new TextPageRoutHandler("~/Pages/Texts/Text.aspx")));

		////Oauth callback pages
		//routes.Add("fbCallback", new Route("FbCallback/{SourcePage}", new WebFormsRouteHandler<IOauthCallbackPageHandler>("~/Pages/Callbacks/FbSuccess.aspx")));
		//routes.Add("twCallback", new Route("TwCallback/{SourcePage}", new WebFormsRouteHandler<IOauthCallbackPageHandler>("~/Pages/Callbacks/TwSuccess.aspx")));


    }

    public static string GetUrl(string routeName)
    {
        return GetUrl(routeName, null);
    }

    public static string GetUrl(string routeName, RouteValueDictionary routeValues)
    {
        return RouteTable.Routes.GetVirtualPath(null, routeName, routeValues).VirtualPath;
    }
}
